Skip to content

ensure moderated file transfers only perform allowed operations#39091

Merged
capnspacehook merged 13 commits into
masterfrom
capnspacehook/file-transfer-req-server-check
Mar 14, 2024
Merged

ensure moderated file transfers only perform allowed operations#39091
capnspacehook merged 13 commits into
masterfrom
capnspacehook/file-transfer-req-server-check

Conversation

@capnspacehook
Copy link
Copy Markdown
Contributor

@capnspacehook capnspacehook commented Mar 7, 2024

Fixes https://github.com/gravitational/teleport-private/issues/1055.
Closes https://github.com/gravitational/teleport-private/issues/1391.

To reduce complexity and the risk of file transfer requests getting reused again (see the above issue 1055) pending file transfer requests are now limited to one per session. Creating multiple in-flight file transfer requests for moderated sessions didn't properly work before anyway, so I don't think we're losing anything by doing this. The SFTP server now also only allows necessary operations for the session's approved file transfer request if there is one present.

This change should be backwards compatible as the API for managing file transfer requests has not changed, only previously non-functional behavior has been removed. Since Nodes re-exec themselves to start an SFTP server, Node processes now sending file transfer request info to SFTP server processes shouldn't pose a compatibility issue.

Reviewed already in https://github.com/gravitational/teleport-private/pull/1399, just need approvals to get this merged.

changelog: only allow necessary operations during moderated file transfers and limit in-flight file transfer requests to one per session

@capnspacehook capnspacehook added server-access sftp Issues related to Teleport's SFTP implementation backport/branch/v14 labels Mar 7, 2024
@zmb3
Copy link
Copy Markdown
Collaborator

zmb3 commented Mar 7, 2024

improve security is a bit vague - can we come up with a better changelog entry?

Comment thread integration/integration_test.go Outdated
Comment thread integration/integration_test.go Outdated
Comment thread integration/integration_test.go Outdated
Comment thread integration/integration_test.go Outdated
Comment thread integration/integration_test.go Outdated
Comment thread tool/teleport/common/sftp.go Outdated
Comment thread tool/teleport/common/sftp.go Outdated
Comment thread tool/teleport/common/sftp.go Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When do we plan to address this TODO?

Copy link
Copy Markdown
Contributor Author

@capnspacehook capnspacehook Mar 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soon, it's tracked here: https://github.com/gravitational/teleport-private/issues/1401. It wasn't included in this fix because this fix will be added to a patch release, and addressing this TODO is technically breaking behavior so best saved for another PR and not backported.

Comment thread tool/teleport/common/sftp.go Outdated
Comment thread tool/teleport/common/sftp.go Outdated
Comment thread integration/integration_test.go Outdated
Comment thread integration/integration_test.go Outdated
Comment thread integration/integration_test.go Outdated
Comment thread lib/srv/sess.go Outdated
Comment thread lib/srv/sess.go Outdated
Comment thread tool/teleport/common/sftp.go Outdated
Comment thread tool/teleport/common/sftp.go Outdated
@capnspacehook
Copy link
Copy Markdown
Contributor Author

@zmb3 how's the updated changelog entry?

@capnspacehook capnspacehook requested review from Tener and avatus and removed request for GavinFrazar and hugoShaka March 13, 2024 15:22
@capnspacehook
Copy link
Copy Markdown
Contributor Author

@zmb3 can I get another review please?

Copy link
Copy Markdown
Collaborator

@zmb3 zmb3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're almost there.

I think we can remove the custom buffered reader type, and I think the changelog entry should mention that only 1 in-flight request is allowed now.

Otherwise looks good!

Comment thread tool/teleport/common/sftp.go Outdated
@capnspacehook
Copy link
Copy Markdown
Contributor Author

@zmb3 the changelog entry look like what you had in mind?

@capnspacehook capnspacehook force-pushed the capnspacehook/file-transfer-req-server-check branch from a942cce to f60120e Compare March 13, 2024 23:09
@capnspacehook capnspacehook added this pull request to the merge queue Mar 13, 2024
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Mar 14, 2024
@capnspacehook capnspacehook added this pull request to the merge queue Mar 14, 2024
Merged via the queue into master with commit 3040023 Mar 14, 2024
@capnspacehook capnspacehook deleted the capnspacehook/file-transfer-req-server-check branch March 14, 2024 00:28
@public-teleport-github-review-bot
Copy link
Copy Markdown

@capnspacehook See the table below for backport results.

Branch Result
branch/v14 Failed
branch/v15 Failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server-access sftp Issues related to Teleport's SFTP implementation size/md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants